<template>
    <view>
        <!--pages/details/details.wxml-->
        <view :class="light ? 'del-page' : 'del-page-night'">
            <view class="del-icon"><span class="iconfont icon-group28" @tap.native="change"></span></view>
            <view class="del-title">
                {{ news.title }}
            </view>
            <view class="del-aside">
                {{ news.source }}
                {{ news.pubDate }}
            </view>
            <!--这里开始是内容-->
			<view class="content" >
				{{news.content}}
			</view>
            <!-- <block v-for="(item, index) in news.allList" :key="index">
                <view class="allList">
                    <image v-if="item.url" mode="widthFix" :src="item.url"></image>
                    <view class="text" v-else>{{ item }}</view>
                </view>
            </block> -->
        </view>
        <view class="fen-box">
            <view class="fen-hr"></view>
            <view class="fen-item"></view>
        </view>
    </view>
</template>

<script>
// pages/details/details.js
export default {
    data() {
        return {
            news: {
                title: '',
                source: '',
                pubDate: '',
                allList: []
            },
            array: {},
            light: true
        };
    },
    onLoad: function (options) {
        // #页面初始化 options为页面跳转所带来的参数
        var array = getApp().globalData.array;
        this.setData({
            news: array
        });
        console.log(array);
    },
    onReady: function () {
        // 页面渲染完成
    },
    onShow: function () {
        // 页面显示
    },
    onHide: function () {
        // 页面隐藏
    },
    onUnload: function () {
        // 页面关闭
    },
    methods: {
        change: function () {
            this.light = !this.light;
            this.setData({
                light: this.light
            });
            console.log(this.light);
        }
    }
};
</script>
<style>
@import './details.css';
</style>
<style scoped lang="less">
	.content{
		padding: 0 20rpx;
		box-sizing: border-box;
	}
</style>
